fix: treat invalid or missing dashboard timestamps as stale - #288
Merged
karagozemin merged 1 commit intoAug 31, 2026
Merged
Conversation
Date.parse() returns NaN for unparseable input, and every comparison against NaN (including >) evaluates to false in JavaScript. Without an explicit check, a malformed or missing fetchedAt would silently be reported as fresh instead of triggering the staleness warning. isStale() now returns true for missing/null/undefined timestamps and for strings that fail to parse, while leaving valid-timestamp freshness behavior (including future timestamps) unchanged.
|
@ASIDISG Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #281.
Problem
isStale()inapps/web/src/hooks/useDashboardData.tscomparedDate.parse(fetchedAt)againstnowMsusing>.Date.parse()returnsNaNfor unparseable input, and any comparison againstNaN(including>) evaluates tofalsein JavaScript — so a malformed or missing timestamp was silently classified as fresh instead of stale.Fix
isStale()now:true(stale) for a missing/null/undefinedfetchedAt.true(stale) whenDate.parse(fetchedAt)is not finite (unparseable string).Tests
Added
apps/web/src/hooks/useDashboardData.test.ts(registered inapps/web/package.json'stestscript, matching this workspace's convention of listing test files explicitly):null,undefined— all stale.Verification
tsc --noEmit -p tsconfig.json— clean.apps/webtest suite (node --import tsx --test ...) — 56/56 passing, no regressions.